﻿using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;

public class HPBarItem : UIItemBase
{
    public Slider SldHp;
    public SoarDText TxtHp;
    public SoarDText TxtState;

    public Transform mTarget;

    public override void DoLoaded()
    {
    }

    public override void DoCreate()
    {
        mTarget = (_params[0] as GameObject).transform;
        Follow(0);
        TimeManager.Instance.AddFrame(this, Follow);
    }

    public override void DoDestory()
    {
    }

    public void Follow(float dt)
    {
        Vector2 pos = UIManager.TransformToCanvasLocalPosition(mTarget);
        pos.y += 80;
        mTran.anchoredPosition = pos;
    }
}